package com.itheima.d1_char_stream;

import java.io.FileReader;
import java.io.Reader;

public class FileReaderTest1 {
    public static void main(String[] args) {
        try(Reader fr = new FileReader("IO_app2\\src\\itheima01.txt");

        ){
            //2.读文本的数据
//            int c;//记住每次读取的字符编号
//            while ((c = fr.read()) != -1){
//                System.out.print((char) c);
//            }
            //3.每次读取多个字符
            char[] buffer = new char[3];
            int len;
            while ((len  = fr.read(buffer)) != -1){
                //读取多少倒出多少
                String s = new String(buffer, 0, len);
                System.out.print(s);
            }
            //性能比较不错
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
